{$CLEO .cs}
{$USE CLEO+}
{$USE newOpcodes}
{$USE ini}

0000: NOP

script_name "The weapon is on the player"

// By ArtemQa146

//________________$$$$
//______________$$____$$
//______________$$____$$
//______________$$____$$
//______________$$____$$
//______________$$____$$
//__________$$$$$$____$$$$$$
//________$$____$$____$$____$$$$
//________$$____$$____$$____$$__$$
//_$$$$$__$$____$$____$$____$$____$$
//_$____$$$$________________$$____$$
//_$______$$______________________$$
//__$$____$$______________________$$
//___$$___$$___By ArtemQa146______$$
//____$$__________________________$$
//_____$$$________________________$$
//______$$______________________$$$
//_______$$$____________________$$
//________$$____________________$$
//_________$$$________________$$$
//__________$$________________$$
//__________$$$$$$$$$$$$$$$$$$$$


const

    Pistol_model = 13@
    Rifle_model = 14@
    Parachute = 15@
    Knuckles = 16@
    iBuffer = 17@
    N_Goggles = 18@
    T_Goggles = 19@
    Grenade = 20@
    Weapon_id_Grenade = 21@
    Grenade_model = 22@
    Knife = 23@
    Ammo_check = 24@
    katana = 25@
    Cheat_test = 26@
    Bit_Sets = 27@
    Weapon_id_rifle = 28@
    Weapon_id_pistol = 29@
    Pistol = 30@
    Rifle = 31@
    
    // 
    priority_rifle = 1
    priority_shotgun = 2
    priority_sniper = 3
    priority_mp5 = 4
    Back_visible = 5
    Left_visible = 6
    Parachute_Priority = 7
    Knuckles_Visible = 8
    Goggles = 9
    katana_set = 10
    katana_rifle = 11
    rifle_pos_1 = 12
    rifle_pos_2 = 13
    pistol_pos_1 = 14
    pistol_pos_2 = 15
    rifle_pos_3 = 16
    rifle_pos_4 = 17
    rifle_pos_5 = 18
    pistol_pos_3 = 19
    grenade_vis = 20
    grenade_pos_1 = 21
    grenade_pos_2 = 22
    katana_pos_1 = 23
    katana_pos_2 = 24
    knife_vis = 25
    knife_pos_1 = 26
    knife_pos_2 = 27
    priority_pistol = 28
    priority_uzi = 29
    priority_sawnoff = 30
    
    //  
    Pistol_X = 0.1
    Pistol_Y = 0.0
    Pistol_Z = -0.065
    
    Pistol2_X = 0.05
    Pistol2_Y = -0.08
    Pistol2_Z = 0.08
    
    Rifle_X = 0.27
    Rifle_Y = -0.13
    Rifle_Z = 0.0
    
    Rifle2_X = 0.28
    Rifle2_Y = -0.2
    Rifle2_Z = 0.0
    
    Rifle3_X = 0.28
    Rifle3_Y = -0.19
    Rifle3_Z = -0.05
    
    Rifle4_X = 0.24
    Rifle4_Y = -0.12
    Rifle4_Z = -0.12
    
    katana_X = 0.32
    katana_Y = -0.142
    katana_Z = -0.03
    
    Rara_X = 0.10
    Rara_Y = -0.15
    Rara_Z = 0.0
    
end


//    +,      
if
    0AA2: 31@ = load_dynamic_library "CLEO+.cleo"
then
    if
        0AA4: 30@ = get_dynamic_library_procedure "GetCleoPlusVersion" library 31@
    then
        0AA7: call_function_return 30@ num_params 0 pop 0 29@
        if
            not 29@ >= 0x1020000
        then
            0AD1: show_formatted_text_highpriority "Cleo+ 1.2.0 (or higher) version is required, the Ammunation Seller - Alternative is disabled" time 15000
            0AA3: free_dynamic_library 31@
            0A93: terminate_this_custom_script
        end
        0AA3: free_dynamic_library 31@
    end
else
    0AD1: show_formatted_text_highpriority "Cleo+ 1.2.0 (or higher) version is required, the Ammunation Seller - Alternative is disabled" time 15000
    0AA3: free_dynamic_library 31@
    0A93: terminate_this_custom_script
end

08C3: clear Bit_Sets bit Parachute_Priority
08C3: clear Bit_Sets bit Knuckles_Visible
08C3: clear Bit_Sets bit Goggles

08C3: clear Bit_Sets bit Back_visible
08C3: clear Bit_Sets bit Left_visible
08C3: clear Bit_Sets bit katana_set
08C3: clear Bit_Sets bit katana_rifle
08C3: clear Bit_Sets bit rifle_pos_1
08C3: clear Bit_Sets bit rifle_pos_2
08C3: clear Bit_Sets bit rifle_pos_3
08C3: clear Bit_Sets bit rifle_pos_4
08C3: clear Bit_Sets bit rifle_pos_5
08C3: clear Bit_Sets bit pistol_pos_1
08C3: clear Bit_Sets bit pistol_pos_2
08C3: clear Bit_Sets bit pistol_pos_3
08C3: clear Bit_Sets bit grenade_pos_1
08C3: clear Bit_Sets bit grenade_pos_2
08C3: clear Bit_Sets bit grenade_vis
08C3: clear Bit_Sets bit katana_pos_1
08C3: clear Bit_Sets bit katana_pos_2
08C3: clear Bit_Sets bit knife_vis
08C3: clear Bit_Sets bit knife_pos_1
08C3: clear Bit_Sets bit knife_pos_2

08C3: clear Bit_Sets bit priority_rifle
08C3: clear Bit_Sets bit priority_shotgun
08C3: clear Bit_Sets bit priority_sniper
08C3: clear Bit_Sets bit priority_mp5

08C3: clear Bit_Sets bit priority_pistol
08C3: clear Bit_Sets bit priority_uzi
08C3: clear Bit_Sets bit priority_uzi

// 
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Brass Knuckles"
if 0@ == 1
then 08BD: set Bit_Sets bit Knuckles_Visible
end

//     
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Goggles"
if 0@ == 1
then 08BD: set Bit_Sets bit Goggles
end

//   
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Parachute"
if 0@ == 1
then 08BD: set Bit_Sets bit Parachute_Priority
end

//    
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Rifle"
if 0@ == 1
then 08BD: set Bit_Sets bit Back_visible
end
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Pistol"
if 0@ == 1
then 08BD: set Bit_Sets bit Left_visible
end
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Grenade"
if 0@ == 1
then 08BD: set Bit_Sets bit grenade_vis
end
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Knife"
if 0@ == 1
then 08BD: set Bit_Sets bit knife_vis
end

//    
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Settings" key "Visible Katana"
if 0@ == 1
then 08BD: set Bit_Sets bit katana_set
end
0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Visible with rifle"
if 0@ == 1
then 08BD: set Bit_Sets bit katana_rifle
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Mode"
if 0@ == 1
then 08BD: set Bit_Sets bit rifle_pos_1
end
if 0@ == 2
then 08BD: set Bit_Sets bit rifle_pos_2
end
if 0@ == 3
then 08BD: set Bit_Sets bit rifle_pos_3
end
if 0@ == 4
then 08BD: set Bit_Sets bit rifle_pos_4
end
if 0@ == 5
then 08BD: set Bit_Sets bit rifle_pos_5
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Mode"
if 0@ == 1
then 08BD: set Bit_Sets bit katana_pos_1
end
if 0@ == 2
then 08BD: set Bit_Sets bit katana_pos_2
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Mode"
if 0@ == 1
then 08BD: set Bit_Sets bit pistol_pos_1
end
if 0@ == 2
then 08BD: set Bit_Sets bit pistol_pos_2
end
if 0@ == 3
then 08BD: set Bit_Sets bit pistol_pos_3
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Mode"
if 0@ == 1
then 08BD: set Bit_Sets bit grenade_pos_1
end
if 0@ == 2
then 08BD: set Bit_Sets bit grenade_pos_2
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Mode"
if 0@ == 1
then 08BD: set Bit_Sets bit knife_pos_1
end
if 0@ == 2
then 08BD: set Bit_Sets bit knife_pos_2
end

0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Priority"
if 0@ == 1
then 08BD: set Bit_Sets bit priority_rifle
end
if 0@ == 2
then 08BD: set Bit_Sets bit priority_shotgun
end
if 0@ == 3
then 08BD: set Bit_Sets bit priority_sniper
end
if 0@ == 4
then 08BD: set Bit_Sets bit priority_mp5
end


0AF0: 0@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Priority"
if 0@ == 1
then 08BD: set Bit_Sets bit priority_pistol
end
if 0@ == 2
then 08BD: set Bit_Sets bit priority_uzi
end
if 0@ == 3
then 08BD: set Bit_Sets bit priority_sawnoff
end



get_label_pointer iBuffer = label @Buffer

if
    08B7:   test Bit_Sets bit rifle_pos_5 // 
then

    1@ = 0
    0AF0: 1@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Bone"
    2@ = 1
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Offset X"
    2@ = 2
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Offset Y"
    2@ = 3
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Offset Z"
    2@ = 4
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Rotation X"
    2@ = 5
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Rotation Y"
    2@ = 6
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Rifle Position" key "Rotation Z"
    2@ = 7
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
end

if
    08B7:   test Bit_Sets bit pistol_pos_3 // 
then

    1@ = 0
    0AF0: 1@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Bone"
    2@ = 8
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Offset X"
    2@ = 9
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Offset Y"
    2@ = 10
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Offset Z"
    2@ = 11
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Rotation X"
    2@ = 12
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Rotation Y"
    2@ = 13
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Pistol Position" key "Rotation Z"
    2@ = 14
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
end


if
    08B7:   test Bit_Sets bit grenade_pos_2 // 
then

    1@ = 0
    0AF0: 1@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Bone"
    2@ = 15
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Offset X"
    2@ = 16
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Offset Y"
    2@ = 17
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Offset Z"
    2@ = 18
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Rotation X"
    2@ = 19
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Rotation Y"
    2@ = 20
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Grenade Position" key "Rotation Z"
    2@ = 21
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
end

if
    08B7:   test Bit_Sets bit katana_pos_2 // 
then

    1@ = 0
    0AF0: 1@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Bone"
    2@ = 22
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Offset X"
    2@ = 23
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Offset Y"
    2@ = 24
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Offset Z"
    2@ = 25
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Rotation X"
    2@ = 26
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Rotation Y"
    2@ = 27
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Katana Position" key "Rotation Z"
    2@ = 28
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
end


if
    08B7:   test Bit_Sets bit knife_pos_2 // 
then

    1@ = 0
    0AF0: 1@ = read_int_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Bone"
    2@ = 29
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Offset X"
    2@ = 30
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Offset Y"
    2@ = 31
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Offset Z"
    2@ = 32
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Rotation X"
    2@ = 33
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Rotation Y"
    2@ = 34
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
    1@ = 0
    0AF2: 1@ = read_float_from_ini_file "cleo\The weapon is on the player.ini" section "Knife Position" key "Rotation Z"
    2@ = 35
    3@ = 2@ * 4
    write_struct_offset iBuffer offset 3@ size 4 value 1@
end

//    
repeat
wait 10
until player.Defined(0)

//   
model.Load(331)
model.Load(371)
model.Load(368)
model.Load(369)
model.Load(339)
model.Load(335)
038B: load_requested_models

if
    08B7:   test Bit_Sets bit katana_pos_1 // 
then
    0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 339 bone 3 offset katana_X katana_y katana_z rotation 10.0 249.0 0.0 store_to katana
    0E37: set_render_object_scale katana 0.87 0.87 0.87
else
   
    0@ = 88
    read_struct_offset 4@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 5@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 6@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 7@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 8@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 9@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 10@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 339 bone 4@ offset 5@ 6@ 7@ rotation 8@ 9@ 10@ store_to katana
    0E37: set_render_object_scale katana 0.87 0.87 0.87
end

if
    08B7:   test Bit_Sets bit knife_pos_1 // 
then
    0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 335 bone 41 offset 0.28 0.1 -0.02 rotation 295.0 135.0 351.0 store_to Knife
    0E37: set_render_object_scale Knife 0.87 0.87 0.87
else
    0@ = 116
    read_struct_offset 4@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 5@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 6@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 7@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 8@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 9@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0@ += 4
    read_struct_offset 10@ iBuffer offset 0@ size 4   // Read ID of Model 2
    0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 335 bone 4@ offset 5@ 6@ 7@ rotation 8@ 9@ 10@ store_to Knife
    0E37: set_render_object_scale Knife 0.87 0.87 0.8
end


0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 371 bone 3 offset Rara_X Rara_Y Rara_Z rotation 270.0 90.0 90.0 store_to Parachute

0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 331 bone 24 offset 0 0 0 rotation 0 0 0 store_to Knuckles

0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 368 bone 5 offset 0.06 0.105 -0.002 rotation 0 0 -25.0 store_to N_Goggles
0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 369 bone 5 offset 0.06 0.105 -0.002 rotation 0 0 -25.0 store_to T_Goggles

gosub @Hide_Other //   

//  
model.Destroy(331)
model.Destroy(371)
model.Destroy(368)
model.Destroy(369)
model.Destroy(339)
model.Destroy(335)

Weapon_id_pistol = -1
Pistol = -1
Grenade = -1
Rifle = -1
Weapon_id_rifle = -1
Cheat_test = false
timera = 0


while true
wait 0
    if
        player.Defined(0)
    then
        gosub @Hide_Other //   
        
        if
            0ADC:   test_cheat "WEAPONOFF"
        then
            Cheat_test = true
        end
        
        if
            0ADC:   test_cheat "WEAPONON"
        then
            Cheat_test = false
        end
        
        if
            Cheat_test == true
        then
            if
                not Pistol == -1
            then
                0E31: set_render_object_visible Pistol 0
            end
            if
                not Rifle == -1
            then
                0E31: set_render_object_visible Rifle 0
            end
            if
                not Grenade == -1
            then
                0E31: set_render_object_visible Grenade 0
            end
        end

        if
            Cheat_test == false
        then
        
            gosub @Other // , ,  
        
            if
                08B7:   test Bit_Sets bit grenade_vis
            then
                if and
                    not Grenade == -1
                    0491:   actor $PLAYER_ACTOR has_weapon Weapon_id_Grenade
                then
                    if
                        82D8:   not actor $PLAYER_ACTOR current_weapon == Weapon_id_Grenade //     ,   
                    then
                        0E31: set_render_object_visible Grenade 1
                    else
                        0E31: set_render_object_visible Grenade 0
                    end
                else
                    if and
                        8491:   not actor $PLAYER_ACTOR has_weapon Weapon_id_Grenade
                        not Grenade == -1
                    then
                        0E2F: delete_render_object Grenade
                        Grenade = -1
                        Grenade_model = -1
                    end
                end

                4@ = false

                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 9 weapon 1@ ammo 2@ model 3@ // 3 - , 4 , 5 
                if
                    3@ > 0
                then
                    4@ = true
                end

                if
                    4@ == true
                then
                    if
                        803B:   not 3@ == Grenade_model  // (int)
                    then
                        if
                            not Grenade == -1
                        then
                            0E2F: delete_render_object Grenade
                            Grenade = -1
                        end


                        0085: Grenade_model = 3@ // (int)
                        0085: Weapon_id_Grenade = 1@ // (int)

                        model.Load(3@)
                        038B: load_requested_models
                        //    
                        if
                            08B7:   test Bit_Sets bit grenade_pos_1 // 
                        then
                            0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 41 offset 0.05 0.0 -0.135 rotation 170.0 270.0 110.0 store_to Grenade
                            0E37: set_render_object_scale Grenade 0.85 0.85 0.85
                        else
                            if
                                08B7:   test Bit_Sets bit grenade_pos_2 // 
                            then
                                0@ = 60
                                read_struct_offset 4@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 5@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 6@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 7@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 8@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 9@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 10@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 4@ offset 5@ 6@ 7@ rotation 8@ 9@ 10@ store_to Grenade
                                0E37: set_render_object_scale Grenade 0.85 0.85 0.85
                            end
                        end
                        model.Destroy(3@)

                    end
                end
            end
            

            //
        
            if
                08B7:   test Bit_Sets bit Left_visible
            then
                if and
                    not Pistol == -1
                    0491:   actor $PLAYER_ACTOR has_weapon Weapon_id_pistol
                then
                    if
                        82D8:   not actor $PLAYER_ACTOR current_weapon == Weapon_id_pistol //     ,   
                    then
                        0E31: set_render_object_visible Pistol 1
                    else
                        0E31: set_render_object_visible Pistol 0
                    end
                else
                    if and
                        8491:   not actor $PLAYER_ACTOR has_weapon Weapon_id_pistol
                        not Pistol == -1
                    then
                        0E2F: delete_render_object Pistol
                        Pistol = -1
                        Pistol_model = -1
                    end
                end

                4@ = false
                5@ = 0
                6@ = 0
                7@ = 0

                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 3 weapon 9@ ammo 0@ model 5@ // 3 - , 4 , 5 
                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 5 weapon 2@ ammo 0@ model 6@ // 3 - , 4 , 5 
                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 4 weapon 8@ ammo 0@ model 7@ // 3 - , 4 , 5 
                
                if
                    5@ > 0
                then
                    4@ = true
                end
                
                if
                    6@ > 0
                then
                    if
                        not 6@ == 353
                    then
                        4@ = true
                    end
                end
                

                if
                    7@ > 0
                then
                    if
                        7@ == 350
                    then
                        4@ = true
                    end
                end
   

                if
                    4@ == true
                then
                
                    4@ = false

                    if
                        08B7:   test Bit_Sets bit priority_pistol
                    then
                        if
                            5@ > 0
                        then
                            0085: 3@ = 5@ // (int)
                            0085: 1@ = 9@ // (int)
                            4@ = true
                        else
                            if and
                                not 6@ == 353
                                6@ > 0
                            then
                                0085: 3@ = 6@ // (int)
                                0085: 1@ = 2@ // (int)
                                4@ = true
                            else
                                if
                                    7@ == 350
                                then
                                    0085: 3@ = 7@ // (int)
                                    0085: 1@ = 8@ // (int)
                                    4@ = true
                                end
                            end
                        end
                    end
                    
                    if
                        08B7:   test Bit_Sets bit priority_uzi
                    then
                        if and
                            not 6@ == 353
                            6@ > 0
                        then
                            0085: 3@ = 6@ // (int)
                            0085: 1@ = 2@ // (int)
                            4@ = true
                        else
                            if
                                5@ > 0
                            then
                                0085: 3@ = 5@ // (int)
                                0085: 1@ = 9@ // (int)
                                4@ = true
                            else
                                if
                                    7@ == 350
                                then
                                    0085: 3@ = 7@ // (int)
                                    0085: 1@ = 8@ // (int)
                                    4@ = true
                                end
                            end
                        end
                    end
                    
                    
                    if
                        08B7:   test Bit_Sets bit priority_sawnoff
                    then
                        if
                            7@ == 350
                        then
                            0085: 3@ = 7@ // (int)
                            0085: 1@ = 8@ // (int)
                            4@ = true
                        else
                            if
                                5@ > 0
                            then
                                0085: 3@ = 5@ // (int)
                                0085: 1@ = 9@ // (int)
                                4@ = true
                            else
                                if and
                                    not 6@ == 353
                                    6@ > 0
                                then
                                    0085: 3@ = 6@ // (int)
                                    0085: 1@ = 2@ // (int)
                                    4@ = true
                                end
                            end
                        end
                    end
                    

                
                
                    if and
                        4@ == true
                        803B:   not 3@ == Pistol_model  // (int)
                    then
                        if
                            not Pistol == -1
                        then
                            0E2F: delete_render_object Pistol
                            Pistol = -1
                        end


                        0085: Pistol_model = 3@ // (int)
                        0085: Weapon_id_pistol = 1@ // (int)

                        model.Load(3@)
                        038B: load_requested_models
                        //    
                        if
                            08B7:   test Bit_Sets bit pistol_pos_1 // 
                        then
                            0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 41 offset Pistol_X Pistol_Y Pistol_Z rotation 290.0 30.0 0.0 store_to Pistol
                        else
                            if
                                08B7:   test Bit_Sets bit pistol_pos_2 // 
                            then
                                0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 51 offset Pistol2_X Pistol2_Y Pistol2_Z rotation 295.0 25.0 351.0 store_to Pistol
                            else
                                0@ = 32
                                read_struct_offset 4@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 5@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 6@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 7@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 8@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 9@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0@ += 4
                                read_struct_offset 10@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 4@ offset 5@ 6@ 7@ rotation 8@ 9@ 10@ store_to Pistol
                            end
                        end
                        model.Destroy(3@)

                    end
                end
            end


    ////
            if
                08B7:   test Bit_Sets bit Back_visible
            then

                if
                    08B7:   test Bit_Sets bit Parachute_Priority
                then
                    if
                        0491:   actor $PLAYER_ACTOR has_weapon 46
                    then
                        0E31: set_render_object_visible Parachute 1
                    else
                        0E31: set_render_object_visible Parachute 0
                    end
                end

                if and
                    not Rifle == -1
                    0491:   actor $PLAYER_ACTOR has_weapon Weapon_id_rifle
                then
                    if and
                        8A0C:   not player $PLAYER_CHAR on_jetpack
                        82D8:   not actor $PLAYER_ACTOR current_weapon == 46 // 
                        82D8:   not actor $PLAYER_ACTOR current_weapon == Weapon_id_rifle //     ,   
                    then
                        if
                            08B7:   test Bit_Sets bit Parachute_Priority
                        then
                            if
                                0491:   actor $PLAYER_ACTOR has_weapon 46
                            then
                                0E31: set_render_object_visible Rifle 0
                            else
                                0E31: set_render_object_visible Rifle 1
                            end
                        else
                            0E31: set_render_object_visible Rifle 1
                        end
                    else
                        0E31: set_render_object_visible Rifle 0
                    end
                else
                    if and
                        8491:   not actor $PLAYER_ACTOR has_weapon Weapon_id_rifle
                        not Rifle == -1
                    then
                        0E2F: delete_render_object Rifle
                        Rifle = -1
                        Rifle_model = -1
                    end
                end

                4@ = false
                5@ = 0
                6@ = 0
                7@ = 0
                8@ = 0

                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 6 weapon 11@ ammo 0@ model 5@ // 3 - , 4 , 5 
                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 4 weapon 2@ ammo 0@ model 6@ // 3 - , 4 , 5 
                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 7 weapon 9@ ammo 0@ model 7@ // 3 - , 4 , 5 
                04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 5 weapon 10@ ammo 0@ model 8@ // 3 - , 4 , 5 
                
                if
                    5@ > 0
                then
                    4@ = true
                end

                if
                    6@ > 0
                then
                    if
                        not 6@ == 350
                    then
                        4@ = true
                    end
                end

                if
                    7@ > 0
                then
                    4@ = true
                end

                if
                    8@ > 0
                then
                    if
                        8@ == 353
                    then
                        4@ = true
                    end
                end


                if
                    4@ == true
                then
                
                    0@ = false
                    4@ = false
                    
                    if
                        08B7:   test Bit_Sets bit priority_rifle
                    then
                        if
                            5@ > 0
                        then
                            0085: 3@ = 5@ // (int)
                            0085: 1@ = 11@ // (int)
                            4@ = true
                        else
                            if and
                                6@ > 0
                                not 6@ == 350
                            then
                                0085: 3@ = 6@ // (int)
                                0085: 1@ = 2@ // (int)
                                4@ = true
                            else
                                if
                                    7@ > 0
                                then
                                    0085: 3@ = 7@ // (int)
                                    0085: 1@ = 9@ // (int)
                                    4@ = true
                                else
                                    if
                                        8@ == 353
                                    then
                                        0085: 3@ = 8@ // (int)
                                        0085: 1@ = 10@ // (int)
                                        4@ = true
                                    end
                                end
                            end
                        end
                    end
                    
                    
                    if
                        08B7:   test Bit_Sets bit priority_shotgun
                    then
                        if and
                            6@ > 0
                            not 6@ == 350
                        then
                            0085: 3@ = 6@ // (int)
                            0085: 1@ = 2@ // (int)
                            4@ = true
                        else
                            if
                                5@ > 0
                            then
                                0085: 3@ = 5@ // (int)
                                0085: 1@ = 11@ // (int)
                                4@ = true
                            else
                                if
                                    7@ > 0
                                then
                                    0085: 3@ = 7@ // (int)
                                    0085: 1@ = 9@ // (int)
                                    4@ = true
                                else
                                    if
                                        8@ == 353
                                    then
                                        0085: 3@ = 8@ // (int)
                                        0085: 1@ = 10@ // (int)
                                        4@ = true
                                    end
                                end
                            end
                        end
                    end
                    
                    if
                        08B7:   test Bit_Sets bit priority_sniper
                    then
                        if
                            7@ > 0
                        then
                            0085: 3@ = 7@ // (int)
                            0085: 1@ = 9@ // (int)
                            4@ = true
                        else
                            if
                                5@ > 0
                            then
                                0085: 3@ = 5@ // (int)
                                0085: 1@ = 11@ // (int)
                                4@ = true
                            else
                                if and
                                    6@ > 0
                                    not 6@ == 350
                                then
                                    0085: 3@ = 6@ // (int)
                                    0085: 1@ = 2@ // (int)
                                    4@ = true
                                else
                                    if
                                        8@ == 353
                                    then
                                        0085: 3@ = 8@ // (int)
                                        0085: 1@ = 10@ // (int)
                                        4@ = true
                                    end
                                end
                            end
                        end
                    end
                    
                    
                    if
                        08B7:   test Bit_Sets bit priority_mp5
                    then
                        if
                            8@ == 353
                        then
                            0085: 3@ = 8@ // (int)
                            0085: 1@ = 10@ // (int)
                            4@ = true
                        else
                            if
                                5@ > 0
                            then
                                0085: 3@ = 5@ // (int)
                                0085: 1@ = 11@ // (int)
                                4@ = true
                            else
                                if and
                                    6@ > 0
                                    not 6@ == 350
                                then
                                    0085: 3@ = 6@ // (int)
                                    0085: 1@ = 2@ // (int)
                                    4@ = true
                                else
                                    if
                                        7@ > 0
                                    then
                                        0085: 3@ = 7@ // (int)
                                        0085: 1@ = 9@ // (int)
                                        4@ = true
                                    end
                                end
                            end
                        end
                    end
                

                    if and
                        4@ == true
                        803B:   not 3@ == Rifle_model  // (int)
                    then
                        if
                            not Rifle == -1
                        then
                            0E2F: delete_render_object Rifle
                            Rifle = -1
                        end

                        0085: Rifle_model = 3@ // (int)
                        0085: Weapon_id_rifle = 1@ // (int)

                        model.Load(3@)
                        038B: load_requested_models
                        //    
                        if
                            08B7:   test Bit_Sets bit rifle_pos_1 // 
                        then
                            0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 3 offset Rifle_X Rifle_Y Rifle_Z rotation 180.0 210.0 0.0 store_to Rifle
                        else
                            if
                                08B7:   test Bit_Sets bit rifle_pos_2 // 
                            then
                                0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 3 offset Rifle2_X Rifle2_Y Rifle2_Z rotation 0.0 210.0 10.0 store_to Rifle
                            else
                                if
                                    08B7:   test Bit_Sets bit rifle_pos_3 // 
                                then
                                    0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 3 offset Rifle3_X Rifle3_Y Rifle3_Z rotation 0.0 180.0 10.0 store_to Rifle
                                else
                                    if
                                        08B7:   test Bit_Sets bit rifle_pos_4 // 
                                    then
                                        0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 3 offset Rifle4_X Rifle4_Y Rifle4_Z rotation 180.0 162.0 2.0 store_to Rifle
                                    else
                                        0@ = 4
                                        read_struct_offset 4@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 5@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 6@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 7@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 8@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 9@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0@ += 4
                                        read_struct_offset 10@ iBuffer offset 0@ size 4   // Read ID of Model 2
                                        0E2E: create_render_object_to_char_bone $PLAYER_ACTOR model 3@ bone 4@ offset 5@ 6@ 7@ rotation 8@ 9@ 10@ store_to Rifle
                                    end
                                end
                            end
                        end
                        model.Destroy(3@)

                    end
                end
            end

            // 
            if
                08B7:   test Bit_Sets bit katana_set //   
            then
                if and
                    8A0C:   not player $PLAYER_CHAR on_jetpack
                    82D8:   not actor $PLAYER_ACTOR current_weapon == 8 //     ,   
                    82D8:   not actor $PLAYER_ACTOR current_weapon == 46 // 
                then
                    if and
                        0491:   actor $PLAYER_ACTOR has_weapon 8 //     ,         .
                        not Weapon_id_rifle == 13 // para
                    then
                        if
                            not Rifle == -1
                        then
                            if
                                08B7:   test Bit_Sets bit katana_rifle //    
                            then
                                if
                                    08B7:   test Bit_Sets bit Parachute_Priority
                                then
                                    if
                                        0491:   actor $PLAYER_ACTOR has_weapon 46
                                    then
                                    else
                                        0E31: set_render_object_visible katana 1
                                    end
                                else
                                    0E31: set_render_object_visible katana 1
                                end
                            end
                        else
                            0E31: set_render_object_visible katana 1
                        end
                    end
                end
            end
        end
    end
end

:Other
if
    02D8:   actor $PLAYER_ACTOR current_weapon == 46 // 
then
    0A96: 0@ = ped $PLAYER_ACTOR struct
    0AA6: call_method 0x5E3990 struct 0@ num_params 1 pop 0 371 //    
    0E31: set_render_object_visible Parachute 1
end

// 
if
    08B7:   test Bit_Sets bit Knuckles_Visible //    
then
    if
        0491:   actor $PLAYER_ACTOR has_weapon 1
    then
        if
            82D8:   not actor $PLAYER_ACTOR current_weapon == 1
        then
            0E31: set_render_object_visible Knuckles 1
        end
    end
end

//    
if
    08B7:   test Bit_Sets bit Goggles //     
then

    if
        0491:   actor $PLAYER_ACTOR has_weapon 44 //   
    then
        if
            02D8:   actor $PLAYER_ACTOR current_weapon == 44
        then
            0A96: 0@ = ped $PLAYER_ACTOR struct
            0AA6: call_method 0x5E3990 struct 0@ num_params 1 pop 0 368 //    
        end
        if
            899D:   not night_vision_enabled
        then
            0E31: set_render_object_visible N_Goggles 1
        end
    end

    if
        0491:   actor $PLAYER_ACTOR has_weapon 45 //   
    then
        if
            02D8:   actor $PLAYER_ACTOR current_weapon == 45
        then
            0A96: 0@ = ped $PLAYER_ACTOR struct
            0AA6: call_method 0x5E3990 struct 0@ num_params 1 pop 0 369 //    
        end
        0A8D: 0@ = read_memory 0xC402B9 size 1 virtual_protect 0 // ds:_ZN12CPostEffects17m_bInfraredVisionE, 1 ; CPostEffects::m_bInfraredVision
        if
            0@ == 0 // 1 -    
        then
            0E31: set_render_object_visible T_Goggles 1
        end
    end
end

// 
if
    08B7:   test Bit_Sets bit knife_vis //    
then
    if
        0491:   actor $PLAYER_ACTOR has_weapon 4
    then
        if
            82D8:   not actor $PLAYER_ACTOR current_weapon == 4
        then
            0E31: set_render_object_visible knife 1
        end
    end
end

return

:Hide_Other
0E31: set_render_object_visible Parachute 0
0E31: set_render_object_visible Knuckles 0
0E31: set_render_object_visible N_Goggles 0
0E31: set_render_object_visible T_Goggles 0
0E31: set_render_object_visible katana 0
0E31: set_render_object_visible knife 0
return


:Buffer
hex
    00(160)    // 400 bytes - can store 100 int values
end